package model

import "gorm.io/gorm"

type Processing struct {
	gorm.Model
	UserId               int                    `gorm:"column:user_id" form:"userId" json:"userId"`
	Date                 *string                `gorm:"column:date" form:"date" json:"date"`
	MaterialNumber       float64                `gorm:"column:material_number" form:"materialNumber" json:"materialNumber"`             //到货数量
	MaterialWeight       float64                `gorm:"column:material_weight" form:"materialWeight" json:"materialWeight"`             //实际到货重量
	ProductNumber        float64                `gorm:"column:product_number" form:"productNumber" json:"productNumber"`                //成品数量
	ProductWeight        float64                `gorm:"column:product_weight" form:"productWeight" json:"productWeight"`                //成品重量
	Rise                 float64                `gorm:"column:rise" form:"rise" json:"rise"`                                            //单据
	MaleWorker           float64                `gorm:"column:male_worker" form:"maleWorker" json:"maleWorker"`                         //结账金额
	WomanWorker          float64                `gorm:"column:woman_worker" form:"womanWorker" json:"womanWorker"`                      //实际货款金额
	MalePayment          float32                `gorm:"column:male_payment" form:"malePayment" json:"malePayment"`                      //实际货款金额
	WomanPayment         float32                `gorm:"column:woman_payment" form:"womanPayment" json:"womanPayment"`                   //实际货款金额
	MaleTotalPayment     float32                `gorm:"column:male_total_payment" form:"maleTotalPayment" json:"maleTotalPayment"`      //实际货款金额
	WomanTotalPayment    float32                `gorm:"column:woman_total_payment" form:"womanTotalPayment" json:"womanTotalPayment"`   //实际货款金额
	AllPayment           float32                `gorm:"column:all_payment" form:"allPayment" json:"allPayment"`                         //总工费
	PreMaterialFee       float32                `gorm:"column:pre_material_price" form:"preMaterialPrice" json:"preMaterialPrice"`      //预估原料总价格
	PreProductFee        float32                `gorm:"column:pre_product_price" form:"preProductPrice" json:"preProductPrice"`         //预估成品总价格
	PreFreight           float32                `gorm:"column:pre_freight" form:"preFreight" json:"preFreight"`                         //预估运费
	PreProductionFee     float32                `gorm:"column:pre_production_fee" form:"preProductionFee" json:"preProductionFee"`      //预估加工费
	PreProfit            float32                `gorm:"column:pre_profit" form:"preProfit" json:"preProfit"`                            //预估盈亏
	YwProcessingMaterial []YwProcessingMaterial `gorm:"ForeignKey:ProcessingId;AssociationForeignKey:Id" json:"materialList,omitempty"` //原料列表
	YwProcessingProduct  []YwProcessingProduct  `gorm:"ForeignKey:ProcessingId;AssociationForeignKey:Id" json:"productList,omitempty"`  //成品列表

}

type YwProcessingMaterial struct {
	gorm.Model
	Date           *string `gorm:"column:date" form:"date" json:"date"`
	ProcessingId   int     `gorm:"column:processing_id" form:"processingId" json:"processingId"`       //加工进程id
	MaterialId     int     `gorm:"column:material_id" form:"materialId" json:"materialId"`             //原料id
	MaterialName   string  `gorm:"column:material_name" form:"materialName" json:"materialName"`       //原料名称
	MaterialNumber float32 `gorm:"column:material_number" form:"materialNumber" json:"materialNumber"` //原料数量
	MaterialWeight float32 `gorm:"column:material_weight" form:"materialWeight" json:"materialWeight"` //原料重量
	MaterialPrice  float32 `gorm:"column:material_price" form:"materialPrice" json:"materialPrice"`    //原料单价
	TotalPrice     float32 `gorm:"column:total_price" form:"totalPrice" json:"totalPrice"`             //原料单价
}

type YwProcessingProduct struct {
	gorm.Model
	Date          *string `gorm:"column:date" form:"date" json:"date"`
	ProcessingId  int     `gorm:"column:processing_id" form:"processingId" json:"processingId"`     //加工进程id
	ProductId     int     `gorm:"column:product_id" form:"productId" json:"productId"`              //成品id
	ProductName   string  `gorm:"column:product_name" form:"productName" json:"productName"`        //成品名称
	ProductNumber float32 `gorm:"column:product_number" form:"productNumber" json:"productNumber"`  //成品数量
	ProductWeight float32 `gorm:"column:product_weight" form:"productWeight" json:"productWeight"`  //成品重量
	PrePrice      float32 `gorm:"column:pre_price" form:"prePrice" json:"prePrice"`                 //预估定价
	PreTotalPrice float32 `gorm:"column:pre_total_price" form:"preTotalPrice" json:"preTotalPrice"` //预估总价
}
